package org.jivesoftware.smack;

import java.net.URI;
import java.net.URISyntaxException;
import org.jivesoftware.smack.proxy.ProxyInfo;
import org.jivesoftware.smack.proxy.ProxyInfo.ProxyType;

public class BOSHConfiguration extends ConnectionConfiguration
{
  private String file;
  private boolean ssl;

  public BOSHConfiguration(String paramString)
  {
    super(paramString, 7070);
    setSASLAuthenticationEnabled(true);
    this.ssl = false;
    this.file = "/http-bind/";
  }

  public BOSHConfiguration(String paramString, int paramInt)
  {
    super(paramString, paramInt);
    setSASLAuthenticationEnabled(true);
    this.ssl = false;
    this.file = "/http-bind/";
  }

  public BOSHConfiguration(boolean paramBoolean, String paramString1, int paramInt, String paramString2, String paramString3)
  {
    super(paramString1, paramInt, paramString3);
    setSASLAuthenticationEnabled(true);
    this.ssl = paramBoolean;
    if (paramString2 != null)
      str = paramString2;
    while (true)
    {
      this.file = str;
      return;
      str = "/";
    }
  }

  public BOSHConfiguration(boolean paramBoolean, String paramString1, int paramInt, String paramString2, ProxyInfo paramProxyInfo, String paramString3)
  {
    super(paramString1, paramInt, paramString3, paramProxyInfo);
    setSASLAuthenticationEnabled(true);
    this.ssl = paramBoolean;
    if (paramString2 != null)
      str = paramString2;
    while (true)
    {
      this.file = str;
      return;
      str = "/";
    }
  }

  public String getProxyAddress()
  {
    String str;
    if (this.proxy != null)
      str = this.proxy.getProxyAddress();
    while (true)
    {
      return str;
      str = null;
    }
  }

  public ProxyInfo getProxyInfo()
  {
    return this.proxy;
  }

  public int getProxyPort()
  {
    int i;
    if (this.proxy != null)
      i = this.proxy.getProxyPort();
    while (true)
    {
      return i;
      i = 8080;
    }
  }

  public URI getURI()
    throws URISyntaxException
  {
    String str;
    if (this.file.charAt(0) != '/')
      this.file = '/' + this.file;
    if (this.ssl)
      str = "https://";
    while (true)
    {
      return new URI(str + getHost() + ":" + getPort() + this.file);
      str = "http://";
    }
  }

  public boolean isProxyEnabled()
  {
    int i;
    if ((this.proxy != null) && (this.proxy.getProxyType() != ProxyInfo.ProxyType.NONE))
      i = 1;
    while (true)
    {
      return i;
      i = 0;
    }
  }

  public boolean isUsingSSL()
  {
    return this.ssl;
  }
}